
<template>
   <van-popup
      :show="state.show"
      round
      position="bottom"
      @close="close"
      style="padding: 10px"
    >
      <slot />
      <van-picker
        v-if="state.option.length > 0"
        :title="title"
        :confirm-button-text="t('confirm')"
        :cancel-button-text="t('cancel')"
        :columns="state.option"
        :default-index="2"
        @confirm="confirm"
        @cancel="close"
      >
      </van-picker>
      <van-empty v-else :description="t('noData')" :image="img_index_path">
        <van-icon name="replay" @click="reload" />{{t('reload')}}</van-empty>
    </van-popup>
</template>

<script setup lang="ts">
import img_index_path from '~/noData.png';
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineProps<{ state: any ,title:string}>()

const emits = defineEmits(['close','confirm','reload']);
const close = () => {
    emits('close');
  };
  const confirm = (e:any) => {
    emits('confirm',e);
  };
  const reload = () => {
    emits('reload');
  };
const count = ref(123456)
defineExpose({
  count
})

console.log(confirm)
</script>
<script lang="ts">
// output component name
export default {
    name: 'Picker'
}
</script>
